home *** CD-ROM | disk | FTP | other *** search
- /* sin.c from page 242*/
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #define R_TO_D 57.29578 /*radians to degrees */
- main(int argc, char **argv)
- {
- double result;
- if(argc < 2)
- {
- printf("usage: %s <degree>\n", argv[0]);
-
- }
- else
- {
- result = sin(atof(argv[1]) / R_TO_D);
- printf("sine (%s deg.) = %f\n",
- argv[1], result);
- }
- }